←Select platform

Macros Property

Summary

Gets or sets the macros.

Syntax

C#
VB
C++
public Dictionary<string,MacroSubsitutionDelegate<T>> Macros {get; set;} 
Public Property Macros As Dictionary(Of String,MacroSubsitutionDelegate(Of T)) 
public: 
property Dictionary<String^,MacroSubsitutionDelegate<T^>^>^ Macros { 
   Dictionary<String^,MacroSubsitutionDelegate<T^>^>^ get(); 
   void set (    Dictionary<String^,MacroSubsitutionDelegate<T^>^>^ ); 
} 

Property Value

The list of macros and delegates to be called to process the macro.

Example

This example adds two macros to the macro processor and process a string.

C#
VB
using Leadtools.Dicom.Common.Anonymization; 
 
public void MacroProcessorSample() 
{ 
   MacroProcessor<object> processor = new MacroProcessor<object>(); 
 
   // 
   // add two macros to the macro processor 
   // 
   processor.Macros.Add("current_date", new MacroSubsitutionDelegate<object>(CurrentDateMacro)); 
   processor.Macros.Add("current_time", new MacroSubsitutionDelegate<object>(CurrentTimeMacro)); 
 
   // 
   // Process a macro string 
   // 
   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}")); 
} 
 
private string CurrentDateMacro(object userData, string name, params object[] parameters) 
{ 
   return DateTime.Now.ToShortDateString(); 
} 
 
private string CurrentTimeMacro(object userData, string name, params object[] parameters) 
{ 
   return DateTime.Now.ToShortTimeString(); 
} 
Imports Leadtools.Dicom.Common.Anonymization 
 
Public Sub MacroProcessorSample() 
   Dim processor As New MacroProcessor(Of Object)() 
 
   ' 
   ' add two macros to the macro processor 
   ' 
   processor.Macros.Add("current_date", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentDateMacro)) 
   processor.Macros.Add("current_time", New MacroSubsitutionDelegate(Of Object)(AddressOf CurrentTimeMacro)) 
 
   ' 
   ' Process a macro string 
   ' 
   Console.WriteLine(processor.Process(processor, "${current_date} ==> ${current_time}")) 
End Sub 
 
Private Function CurrentDateMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String 
   Return DateTime.Now.ToShortDateString() 
End Function 
 
Private Function CurrentTimeMacro(ByVal userData As Object, ByVal name As String, ByVal ParamArray parameters As Object()) As String 
   Return DateTime.Now.ToShortTimeString() 
End Function 

Requirements

Target Platforms

Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
Leadtools.Dicom.Common Assembly
Click or drag to resize